<script>
import outMain from "@/components/outMain.vue";
import { ElMessage, ElMessageBox, ElLoading } from "element-plus";
import { User } from "@/http/api";

export default {
  components: { outMain },
  name: "",
  data() {
    return {
      tableData: [
        {
          comName: "四川省本地鸟科技有限公司",
          comCode: "219837297392379",
          userName: "吴欢",
          userPhone: "18483613963",
          sealNum: 3,
          sealErrNum: 2,
          create_time: "2025-03-11 51:31:44",
        },
      ],
      queryData: {
        nick_name: "",
        page: 1,
        per_page: 10,
      },
      total: 0,
    };
  },
  props: {},
  setup() {},
  methods: {
    serchFn() {
      this.queryData.page = 1;
      this.getData();
    },
    getData() {
      const loading = ElLoading.service({
        lock: true,
        text: "Loading",
        background: "rgba(255, 255, 255, 0.7)",
      });
      User(this.queryData).then((res) => {
        setTimeout(() => {
          loading.close();
        }, 100);
        if (res.data.code == 1) {
          this.tableData = res.data.data.data;
          this.total = res.data.data.total;
        }
      });
    },
  },
  mounted() {},
  async created() {
    // this.getData();
  },
};
</script>
<template>
  <outMain>
    <div class="tableCont">
      <div class="tableName flexCont">
        <div>平台用户列表（{{ total }}）</div>
      </div>
      <div class="tableSerch">
        <div class="serchLeft"></div>
        <div class="serchRight">
          <el-form class="flexCenter" :inline="true">
            <el-form-item>
              <el-input
                clearable
                @clear="getData"
                @keyup.enter="getData"
                v-model="queryData.nick_name"
                placeholder="请输入用户名称"
              />
            </el-form-item>
            <el-button class="hasBottom" type="primary" @click="serchFn">
              <span class="iconfont icon-sousuo"></span>
              <span>搜索</span>
            </el-button>
          </el-form>
        </div>
      </div>
      <el-table class="tableMain" :data="tableData" stripe>
        <el-table-column
          prop="comName"
          width="200"
          show-overflow-tooltip
          label="企业名称"
        />
        <el-table-column
          width="200"
          prop="comCode"
          show-overflow-tooltip
          label="统一信用代码"
        />
        <el-table-column
          prop="userName"
          show-overflow-tooltip
          label="法定人姓名"
        />
        <el-table-column
          prop="userPhone"
          show-overflow-tooltip
          label="法定人手机号"
        />
        <el-table-column
          prop="sealNum"
          show-overflow-tooltip
          label="正常印章数"
        />
        <el-table-column
          prop="sealErrNum"
          show-overflow-tooltip
          label="到期印章数"
        />
        <el-table-column
          prop="create_time"
          show-overflow-tooltip
          label="注册时间"
        />
      </el-table>
      <div class="pageCont">
        <el-pagination
          v-model:currentPage="queryData.page"
          v-model:page-size="queryData.per_page"
          background
          small
          layout="total, prev, pager, next, jumper"
          :total="total"
          @size-change="getData"
          @current-change="getData"
        />
      </div>
    </div>
  </outMain>
</template>
<style scoped lang="less"></style>
